// stores/counter.js
import {
	defineStore
} from 'pinia';

export const useCounterStore = defineStore('counter', {
	state: () => {
		return {
			user: uni.getStorageSync('user'),
			info:'',
			type: {
				spec: {
					id: '',
					name: ''
				},
				brand: {
					id: '',
					name: ''
				},
				technology: {
					id: '',
					name: ''
				},
				classification: {
					id: '',
					name: ''
				},
				typename: {
					id: '',
					name: ''
				},
				branname: {
					id: '',
					name: ''
				}
			},
		};
	},
	unistorage: true,
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		// 报错
		setregister(data) {
			this.user = data
		},

		setOrder(data) {
			this.orderinfo = data
		},
		setinfo(data) {
			this.info = data
		},
		setuser(data) {
			console.log("====12=======");
			this.user = data
			uni.setStorageSync('user', data)
		},
	},


});